package sng.modules.view.components.city.state
{
	import as3isolib.geom.Pt;
	
	import flash.geom.Point;
	
	import sng.data.info.GlobalInfo;
	import sng.modules.view.components.city.logic.unit.BaseBuilding;
	
	/**
	 * 
	 * @author leonliu
	 * 提供货物状态
	 * 
	 */	
	public class BuildSupplyGoodsState extends BuildState
	{
		public function BuildSupplyGoodsState()
		{
		}
		
		
		public override function execute(build:BaseBuilding):void
		{
			//供货成功后	
			//触化供货逻辑	
			if(build.currentStrategy.supplyGoodsBuildingStrategy()!=null)
			{
				//触化供货动画	
				var bPoint:Point = new Point(10, -10);
				bPoint = build.sprites[0].localToGlobal(bPoint);
				build.city.doGatherAnimation(bPoint, "goods", true);
				
				//添加文字提示 eason 20110720
				var text:AttachmentTextUp= new AttachmentTextUp("-"+build.vo.needGoods+"货物",AttachmentTextUp.WHITE);
				var pt:Pt=new Pt(build.x,build.y);
				var point:Point=build.city.cityView.isoToLocal(pt);
				point=build.city.cityView.localToGlobal(point);
				build.city.doTextTipAnimation(text,point.x-100,point.y);
				build.removeTip();
			}
		}
		
		public override function getiStateType():uint
		{
			return 4;
		}
	}
}